package com.yan.controller;

import com.yan.beans.BannerInfo;
import com.yan.service.BannerInfoService;
import com.yan.utils.UserUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by Administrator on 2019/12/13 0013.
 */
@Controller
@RequestMapping("banner")
public class BannerController {
    @Resource
   private BannerInfoService bannerInfoService;

    @RequestMapping("/getInfo")
    @ResponseBody
    public List<BannerInfo> getInfo(){
        return bannerInfoService.getInfo();
    }

    @RequestMapping("/bannerInfo")
    public String bannerInfo(HttpServletRequest request){
        if(UserUtil.isLogin(request)){
            return "banner/banner";
        }else {
            return "login";
        }
    }
}
